package com.ruoyi.system.outto.goods.impl;

import com.alibaba.fastjson.JSONObject;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.exception.GlobalException;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.http.HttpUtils;
import com.ruoyi.system.V2.gameAttr.mapper.GameAttrTemplateMapper;
import com.ruoyi.system.V2.gameAttr.mapper.GameAttributeMapper;
import com.ruoyi.system.V2.goodInfo.mapper.GoodsInfoImgMapper;
import com.ruoyi.system.V2.inter.mapper.ArtRecMapper;
import com.ruoyi.system.interAttr.domain.InterAttr;
import com.ruoyi.system.interAttr.mapper.InterAttrMapper;
import com.ruoyi.system.model.domain.*;
import com.ruoyi.system.model.dto.GoodsInfoAndAttrValueDto;
import com.ruoyi.system.outto.core.LCConstant;
import com.ruoyi.system.outto.core.MapUntils;
import com.ruoyi.system.outto.goods.YSYAPI;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.beanutils.ConvertUtils;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.lang.reflect.Field;
import java.util.*;
import java.util.stream.Collectors;

/**
 * @author lz
 * @version 1.0
 * @date 2022/6/5 16:19
 */
@Slf4j
@Service
public class YSYAPIImpl implements YSYAPI {
    @Resource
    private GoodsInfoImgMapper goodsInfoImgMapper;
    @Resource
    private GameAttributeMapper gameAttributeMapper;
    @Value("${desc.title}")
    private String descTitle;
    @Resource
    private InterAttrMapper interAttrMapper;
    @Resource
    private GameAttrTemplateMapper gameAttrTemplateMapper;
    @Resource
    private ArtRecMapper artRecMapper;
    @Override
    public AjaxResult addGame(GoodsInfoAndAttrValueDto goodsInfoAndAttrValueDto, SalePartner salePartner) {
        Map<String, Object> result = new HashMap<>();
        Map<String, Object> params = params(goodsInfoAndAttrValueDto, "add", salePartner);
        log.info("易手游添加接口请求参数={}", JSONObject.toJSONString(params));

//        String response = HttpUtil.postRequest(salePartner.getTwoOther(), JSONObject.toJSONString(params), ContentType.APPLICATION_JSON,null);
        String response = HttpUtils.sendYX915Post("https://www.swcbg.com/api/api/publishShop", JSONObject.toJSONString(params), "application/json");
        log.info("易手游添加接口返回参数={}", response);
        JSONObject resultJson = null;
        try {
            resultJson = JSONObject.parseObject(response);
        }catch (Exception e){
            throw new GlobalException(response);
        }
        if (!"1".equals(resultJson.getString("status"))) {
            result.put("code", 500);
        } else {
            result.put("code", 200);
            String shop_id = JSONObject.parseObject(resultJson.getString("data")).getString("shop_id");
            result.put("outId", shop_id);
        }
        result.put("msg", resultJson.getString("info"));
        result.put("req", JSONObject.toJSONString(params));
        result.put("res", response);
        return AjaxResult.success(result);
    }

    @Override
    public AjaxResult editGame(GoodsInfoAndAttrValueDto goodsInfoAndAttrValueDto, SalePartner salePartner) {
        String path = "edit";
        Map<String, Object> result = new HashMap<>();
        Map<String, Object> params = params(goodsInfoAndAttrValueDto, "update", salePartner);
        log.info("易手游编辑接口请求参数={}", JSONObject.toJSONString(params));
        String response = HttpUtils.sendPost("https://www.swcbg.com/api/api/publishShop", JSONObject.toJSONString(params), "application/json");
        log.info("易手游编辑接口返回参数={}", response);
        JSONObject resultJson = JSONObject.parseObject(response);
        if (!"1".equals(resultJson.getString("status"))) {
            result.put("code", 500);
        } else {
            result.put("code", 200);
        }
        result.put("msg", resultJson.getString("info"));
        result.put("req", JSONObject.toJSONString(params));
        result.put("res", response);
        return AjaxResult.success(result);
    }

    private List<GameAttribute> getGameAttributs(String ids) {
        if (StringUtils.isEmpty(ids)) {
            return new ArrayList<>();
        }
        return gameAttributeMapper.selectGameAttributeListByIds((Long[]) ConvertUtils.convert(ids.split(","),
                Long.class));
    }

    private String reIds(String allIds, String ids) {
        if (StringUtils.isNotEmpty(ids)) {
            if (StringUtils.isNotEmpty(allIds)) {
                allIds = allIds + "," + ids;
            } else {
                allIds = ids;
            }
        }
        return allIds;
    }

    //参数
    private JSONObject Property(GoodsInfoAndAttrValueDto goodsInfoAndAttrValueDto, JSONObject jsonObject, Map<String,Object> params, SalePartner salePartner) {

        String substring = salePartner.getSaleName();
        if (substring.contains("_")) {
            substring = substring.substring(salePartner.getSaleName().indexOf("_") + 1);
        }
        InterAttr interAttr = interAttrMapper.selectInterAttrByConfig(substring, goodsInfoAndAttrValueDto.getGameId());
        String checkAttr = interAttr.getCheckAttr();
        //开始匹配多选属性
        builderCheckAttr(goodsInfoAndAttrValueDto, jsonObject,params, checkAttr);

        return jsonObject;
    }

    private void builderCheckAttr(GoodsInfoAndAttrValueDto goodsInfoAndAttrValueDto, JSONObject jsonObject, Map<String,Object> params, String checkAttr) {
        /**
         * 1、先查询自定义中所有多选的字段
         * 2、再查该账号单选字段中的选项
         * 3、再去接口属性匹配表过滤
         */
        Field[] declaredFields = goodsInfoAndAttrValueDto.getClass().getDeclaredFields();
        JSONObject checkAttrJson = JSONObject.parseObject(checkAttr);
        String interCheckBoxReqs = checkAttrJson.getString("interCheckBoxReqs");
        List<JSONObject> checkJsonList = JSONObject.parseArray(interCheckBoxReqs, JSONObject.class);
        if (org.springframework.util.CollectionUtils.isEmpty(checkAttrJson)) {
            throw new GlobalException("接口多选属性暂未配置");
        }

        GameAttrTemplate gameAttrTemplate = new GameAttrTemplate();
        gameAttrTemplate.setGameId(goodsInfoAndAttrValueDto.getGameId());
        gameAttrTemplate.setIsEnable("0");
        List<String> types = new ArrayList<>();
        types.add("checkbox");
        types.add("boxradio");
        gameAttrTemplate.setFieldTypes(types);
        List<GameAttrTemplate> checkAttrTemplates = gameAttrTemplateMapper.selectGameAttrTemplateList(gameAttrTemplate);

        for (JSONObject object : checkJsonList) {
            String string = "";
            String InterConfigId = object.getString("InterConfigId");
            for (GameAttrTemplate attrTemplate : checkAttrTemplates) {
                String aavName = attrTemplate.getAavName();
                for (Field declaredField : declaredFields) {
                    String name = declaredField.getName();
                    if (aavName.equals(name)) {
                        declaredField.setAccessible(true);

                        String ydConfigIdLeveOne = object.getString("YdConfigId");
                        if (StringUtils.isNotEmpty(ydConfigIdLeveOne)) {

                            String[] split2 = ydConfigIdLeveOne.split(",");
                            List<String> list2 = new ArrayList<>();
                            for (String s : split2) {
                                s = s.replace(" ", "");
                                list2.add(s);
                            }
                            if (list2.contains(attrTemplate.getId() + "")) {
                                Object o = null;
                                try {
                                    o = declaredField.get(goodsInfoAndAttrValueDto);
                                } catch (IllegalAccessException e) {
                                    throw new GlobalException("多选项" + attrTemplate.getFieldName() + "匹配错误");
                                }
                                String oneValue = String.valueOf(o);
                                if (StringUtils.isNotEmpty(ydConfigIdLeveOne)) {
                                    //一级属性已经匹配，开始匹配二级属性
                                    if (list2.contains(attrTemplate.getId() + "")) {
                                        String interCheckBoxReqsStr = object.getString("interCheckBoxReqs");
//                                        String interCheckBoxReqsStr = object.getString("interServerRes");
                                        //开始匹配二级属性
                                        List<JSONObject> jsonObjects2 = JSONObject.parseArray(interCheckBoxReqsStr, JSONObject.class);
                                        /**
                                         * 咱们的f字段  多选项都是用空格 隔开，用,号切割数组，跟匹配的数据匹配、匹配上说明此账号勾选的有此属性
                                         */
                                        for (JSONObject jsonObject1 : jsonObjects2) {
                                            if (StringUtils.isNotEmpty(oneValue)&&!oneValue.equals("null")) {
                                                String[] split1 = oneValue.split(",");
                                                String ydConfigId1 = jsonObject1.getString("YdConfigId");
                                                for (String s : split1) {
                                                    if (Objects.equals(s, ydConfigId1)) {
                                                        String InterConfigId2 = jsonObject1.getString("InterConfigId");
                                                        string+=","+InterConfigId2;
                                                    }
                                                }
                                            }
                                        }
                                    }
                                } else {
                                    throw new GlobalException("属性参数错误，请匹配后重新配置");
                                }
                            }
                        }
                    }
                }
            }
            if(StringUtils.isNotEmpty(string)){
                jsonObject.put(InterConfigId, string.substring(1));
            }
        }
        params.put("shop_data",jsonObject);
        //========================多选属性匹配完成=====================//
    }

    private Map<String, Object> params(GoodsInfoAndAttrValueDto goodsInfoAndAttrValueDto, String type, SalePartner salePartner) {
        GameAttribute gameAttribute = null;
        Integer gameId = 0;
        if(goodsInfoAndAttrValueDto.getGameName().contains("王者荣耀")){
            gameId = 13;
            gameAttribute = gameAttributeMapper.selectGameAttributeById(Long.valueOf(goodsInfoAndAttrValueDto.getF16()));
        }else if(goodsInfoAndAttrValueDto.getGameName().contains("和平精英")){
            gameId = 14;
            gameAttribute = gameAttributeMapper.selectGameAttributeById(Long.valueOf(goodsInfoAndAttrValueDto.getF10()));
        }else if(goodsInfoAndAttrValueDto.getGameName().contains("原神")){
            gameId = 10;
            if(StringUtils.isEmpty(goodsInfoAndAttrValueDto.getF20())){
                throw new GlobalException("实名不能为空!");
            }
            gameAttribute = gameAttributeMapper.selectGameAttributeById(Long.valueOf(goodsInfoAndAttrValueDto.getF20()));
        }else if(goodsInfoAndAttrValueDto.getGameName().contains("穿越火线")){
            gameId = 31;
            gameAttribute = gameAttributeMapper.selectGameAttributeById(Long.valueOf(goodsInfoAndAttrValueDto.getF3()));
        }else if(goodsInfoAndAttrValueDto.getGameName().equals("英雄联盟")){
            gameId = 19;
            gameAttribute = gameAttributeMapper.selectGameAttributeById(Long.valueOf(goodsInfoAndAttrValueDto.getF1()));
        }else if(goodsInfoAndAttrValueDto.getGameName().contains("火影忍者")){
            gameId = 12;
            gameAttribute = gameAttributeMapper.selectGameAttributeById(Long.valueOf(goodsInfoAndAttrValueDto.getF7()));
        }else if(goodsInfoAndAttrValueDto.getGameName().contains("枪战王者")){
            gameId = 17;
            gameAttribute = gameAttributeMapper.selectGameAttributeById(Long.valueOf(goodsInfoAndAttrValueDto.getF10()));
        }else if(goodsInfoAndAttrValueDto.getGameName().contains("蛋仔派对")){
            gameId = 90;
        }else if(goodsInfoAndAttrValueDto.getGameName().contains("永劫无间")){
            gameId = 49;
        }else if(goodsInfoAndAttrValueDto.getGameName().contains("英雄联盟(手游)")){
            gameId = 20;
        }else if(goodsInfoAndAttrValueDto.getGameName().contains("无畏契约")){
            gameId = 101;
        }else if(goodsInfoAndAttrValueDto.getGameName().contains("金铲铲之战")){
            gameId = 18;
        }else if(goodsInfoAndAttrValueDto.getGameName().contains("使命召唤手游")){
            gameId = 30;
        }else if(goodsInfoAndAttrValueDto.getGameName().contains("暗区突围")){
            gameId = 69;
        }else if(goodsInfoAndAttrValueDto.getGameName().contains("三角洲行动")){
            gameId = 172;
        }else{
            throw new GlobalException("当前游戏暂不支持");
        }
        Map<String,Object> params = new HashMap<>();
        Map<String,Object> actions = new TreeMap<>();
        actions.put("user_id",salePartner.getOther());
        actions.put("game_id",gameId);
        params.put("user_id",salePartner.getOther());
        params.put("game_id",gameId);
        String cover = MapUntils.getCover(actions);
        cover = cover+"key="+salePartner.getSaleKey();
        log.info(cover);
        String sign = DigestUtils.md5Hex(cover).toUpperCase();
        params.put("sign", sign);
        if(!type.contains("add")) {
            params.put("shop_id",goodsInfoAndAttrValueDto.getOutId());
        }
        params.put("account",goodsInfoAndAttrValueDto.getAccountNumber());
        GoodsInfoImg goodsInfoImg = new GoodsInfoImg();
        goodsInfoImg.setGoodsId(goodsInfoAndAttrValueDto.getId());
        goodsInfoImg.setType(Constants.STR_1);
        List<GoodsInfoImg> infoImgs = goodsInfoImgMapper.selectGoodsInfoImgList(goodsInfoImg);
        String imgs = "";
        if (!CollectionUtils.isEmpty(infoImgs)) {
            imgs = infoImgs.stream().map(i -> i.getImgUrl()).collect(Collectors.joining(","));
        }
        if (StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getTitleImg())) {
            imgs = goodsInfoAndAttrValueDto.getTitleImg()+","+imgs;
        }
        params.put("img_data",imgs);
        String shop_title = "";
        String shop_desc = "";
        if(StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getDes())){
            if(goodsInfoAndAttrValueDto.getDes().length()>80){
                shop_title = goodsInfoAndAttrValueDto.getDes().substring(0,80);
            }else {
                shop_title = goodsInfoAndAttrValueDto.getDes();
            }
            if(goodsInfoAndAttrValueDto.getDes().length()>180){
                shop_desc = goodsInfoAndAttrValueDto.getDes().substring(0,180);
            }else{
                shop_desc = goodsInfoAndAttrValueDto.getDes();
            }
        }else if(StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getTitle())){
            if(goodsInfoAndAttrValueDto.getTitle().length()>80){
                shop_title = goodsInfoAndAttrValueDto.getTitle().substring(0,80);
            }else {
                shop_title = goodsInfoAndAttrValueDto.getTitle();
            }
            if(goodsInfoAndAttrValueDto.getTitle().length()>180){
                shop_desc = goodsInfoAndAttrValueDto.getTitle().substring(0,180);
            }else{
                shop_desc = goodsInfoAndAttrValueDto.getTitle();
            }
        }else{
            shop_title = "无";
            shop_desc = "无";
        }
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("type","1");
        jsonObject.put("price",goodsInfoAndAttrValueDto.getPrice());
        jsonObject.put("mobile","15225225552");
        jsonObject.put("qq_num","154563546");
        jsonObject.put("shop_title",shop_title);
        jsonObject.put("shop_desc",shop_desc);
        if(goodsInfoAndAttrValueDto.getGameName().contains("和平精英")){

            jsonObject.put("system",goodsInfoAndAttrValueDto.getSystemName()+goodsInfoAndAttrValueDto.getCarrierName());
            jsonObject.put("server","全服");

            if(gameAttribute.getFieldName().equals("可二次实名")){
                jsonObject.put("two_real_img","是");
            }else{
                jsonObject.put("two_real_img","否");
            }
            jsonObject.put("param_2",goodsInfoAndAttrValueDto.getF9()==null||goodsInfoAndAttrValueDto.getF9().equals("")?"0":goodsInfoAndAttrValueDto.getF9());
            jsonObject.put("param_4","未绑定或可换绑");
            jsonObject.put("param_5","黄金");
            jsonObject.put("param_6","0");
            jsonObject.put("param_7","0");
            jsonObject.put("param_8","0");
            jsonObject.put("param_9",goodsInfoAndAttrValueDto.getF8()==null||goodsInfoAndAttrValueDto.getF8().equals("")?"0":goodsInfoAndAttrValueDto.getF8());
            jsonObject.put("param_13","否");
            jsonObject.put("param_14","小于64级");
            if(gameAttribute.getFieldName().equals("可二次实名")){
                jsonObject.put("param_15","能");
            }else{
                jsonObject.put("param_15","不能");
            }
            jsonObject.put("param_16","0");
            jsonObject.put("param_17","自己注册");

            //匹配多选项
            Property(goodsInfoAndAttrValueDto,jsonObject,params,salePartner);
            params.put("shop_data",jsonObject);
        }
        if(goodsInfoAndAttrValueDto.getGameName().contains("王者荣耀")){
            jsonObject.put("system",goodsInfoAndAttrValueDto.getSystemName()+goodsInfoAndAttrValueDto.getCarrierName());
            jsonObject.put("server","全服");
            if(gameAttribute.getFieldName().equals("可二次实名")){
                jsonObject.put("two_real_img","是");
            }else{
                jsonObject.put("two_real_img","否");
            }
            jsonObject.put("param_1","自己注册");

            if(StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF2())){
                GameAttribute gameAttribute1 = gameAttributeMapper.selectGameAttributeById(Long.valueOf(goodsInfoAndAttrValueDto.getF2()));
                jsonObject.put("param_2",gameAttribute1.getFieldName().replace("V",""));
            }else{
                jsonObject.put("param_2","1");
            }
            jsonObject.put("param_3","30");
            jsonObject.put("param_4","未绑定或可换绑");

            if(StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF3())){
                GameAttribute gameAttribute1 = gameAttributeMapper.selectGameAttributeById(Long.valueOf(goodsInfoAndAttrValueDto.getF3()));
                jsonObject.put("param_5",gameAttribute1.getFieldName().replace("最强",""));
            }else{
                jsonObject.put("param_5","青铜");
            }

            jsonObject.put("param_6", StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF6())?goodsInfoAndAttrValueDto.getF6():"0");
            jsonObject.put("param_7", StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF13())?goodsInfoAndAttrValueDto.getF13():"0");
            jsonObject.put("param_8",goodsInfoAndAttrValueDto.getF7()==null||goodsInfoAndAttrValueDto.getF7().equals("")?"0":goodsInfoAndAttrValueDto.getF7().toString());
            jsonObject.put("param_9",goodsInfoAndAttrValueDto.getF8()==null||goodsInfoAndAttrValueDto.getF8().equals("")?"0":goodsInfoAndAttrValueDto.getF8().toString());
            jsonObject.put("param_13","是");
            jsonObject.put("param_14","小于64级");
            if(gameAttribute.getFieldName().equals("可二次实名")){
                jsonObject.put("param_15","能");
            }else{
                jsonObject.put("param_15","不能");
            }

            //匹配多选项
            Property(goodsInfoAndAttrValueDto,jsonObject,params,salePartner);
        }
        if(goodsInfoAndAttrValueDto.getGameName().contains("穿越火线")){
            jsonObject.put("system","QQ官方客户端");
//            String[] qufus = "安徽一区,福建一区,广东一区,广东二区,广东三区,广东四区,广西一区,湖北一区,湖北二区,湖南一区,湖南二区,江苏一区,江苏二区,江西一区,南方大区,陕西一区,上海一区,上海二区,四川一区,四川二区,云南一区,浙江一区,浙江二区,重庆一区,预备大区,北方大区,北京一区,北京二区,北京三区,北京四区,河北一区,河南一区,河南二区,黑龙江一区,吉林一区,辽宁一区,辽宁二区,辽宁三区,山东一区,山东二区,山西一区".split(",");
//            String qufu = "";
//            for(String s : qufus){
//                if(accountInfo.getDes().contains(s)){
//                    qufu = s;
//                }
//            }
//            if(StringUtils.isEmpty(qufu)){
//                qufu = "北方大区";
//            }
            jsonObject.put("server",goodsInfoAndAttrValueDto.getServerName());

            if(gameAttribute.getFieldName().contains("有修改机会")){
                jsonObject.put("two_real_img","是");
            }else{
                jsonObject.put("two_real_img","否");
            }
            jsonObject.put("shop_title",shop_title);
            jsonObject.put("shop_desc",shop_desc);
//            jsonObject.put("param_1","自己注册");
//            String[] string = "'新锐','精英','专家','大师','宗师','枪王','枪王之王'".replace("'","").split(",");
//
//            for(String s : string){
//                if(accountInfo.getDes().contains(s)){
//                    duanwei = s;
//                    break;
//                }
//            }
//            if(StringUtils.isEmpty(duanwei)){
//                duanwei = "无";
//            }
            String duanwei = "";
            if(StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF6())){
                GameAttribute gameAttribute1 = gameAttributeMapper.selectGameAttributeById(Long.valueOf(goodsInfoAndAttrValueDto.getF6()));
                if(gameAttribute1.getFieldName().equals("未定级")){
                    duanwei = "无";
                }else{
                    duanwei = gameAttribute1.getFieldName();
                }
            }
            jsonObject.put("param_2",duanwei);
            jsonObject.put("param_3","30");
            jsonObject.put("param_4","未绑定或可换绑");

            jsonObject.put("param_5","无");


            jsonObject.put("param_6","0");
            jsonObject.put("param_7","0");
            jsonObject.put("param_8","0");
            jsonObject.put("param_11","是");
            jsonObject.put("param_12","自己注册");
            jsonObject.put("param_13","是");
            jsonObject.put("param_14","小于64级");
            if(gameAttribute.getFieldName().contains("有修改机会")){
                jsonObject.put("param_15","能");
            }else{
                jsonObject.put("param_15","不能");
            }
            params.put("shop_data",jsonObject);
        }
        if(goodsInfoAndAttrValueDto.getGameName().contains("蛋仔派对")){
            if(goodsInfoAndAttrValueDto.getSystemName().equals("苹果")){
                jsonObject.put("system","网易（苹果）");
                jsonObject.put("server","苹果服务器");
            }else{
                jsonObject.put("system","网易（安卓）");
                jsonObject.put("server","安卓服务器");
            }
            jsonObject.put("mobile","15225225552");
            jsonObject.put("qq_num","154563546");
            jsonObject.put("shop_insure","0");
            jsonObject.put("second_real","无");
            jsonObject.put("shop_title",shop_title);
            jsonObject.put("shop_desc",shop_desc);
            if(goodsInfoAndAttrValueDto.getServerName().contains("手机")) {
                jsonObject.put("param_1", "手机账号");
            }else if(goodsInfoAndAttrValueDto.getServerName().contains("邮箱")){
                jsonObject.put("param_1", "邮箱账号");
            }else{
                jsonObject.put("param_1", "送邮箱账号（三无邮箱）");
            }
            jsonObject.put("param_2","男");
            jsonObject.put("param_3","30");
            jsonObject.put("param_4","未绑定或可换绑");
            String[] dws = "一阶鹌鹑蛋,二阶鸽子蛋,三阶鸡蛋,四阶鹅蛋,五阶鸵鸟蛋,六阶恐龙蛋,巅峰凤凰蛋".split(",");
            String dw = "";
//            for(String s : dws){
//                if(accountInfo.getDes().contains(s)){
//                    dw = s;
//                    break;
//                }
//            }
//            if(StringUtils.isEmpty(dw)){
//                dw = "一阶鹌鹑蛋";
//            }
            if(StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF3())){
                GameAttribute gameAttribute1 = gameAttributeMapper.selectGameAttributeById(Long.valueOf(goodsInfoAndAttrValueDto.getF3()));
                dw = gameAttribute1.getFieldName();
            }else{
                dw = "一阶斑鸠蛋";
            }
            jsonObject.put("param_5",dw);
            jsonObject.put("param_6","无");
            jsonObject.put("param_7","无");
            jsonObject.put("param_8","无");
            jsonObject.put("param_9","自己注册");

//
//            jsonObject.put("param_10","是");
//            jsonObject.put("param_11","是");
//            jsonObject.put("param_12","自己注册");
//            jsonObject.put("param_13","是");
//            jsonObject.put("param_14","小于64级");
//            jsonObject.put("param_15","能");
//            jsonObject.put("param_16","无");
//            jsonObject.put("param_17","无");
            params.put("shop_data",jsonObject);
        }
        if(goodsInfoAndAttrValueDto.getGameName().equals("枪战王者")){
            jsonObject.put("system",goodsInfoAndAttrValueDto.getSystemName()+goodsInfoAndAttrValueDto.getCarrierName());
            jsonObject.put("server","通用服务器");
            if(StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF10())) {
                GameAttribute gameAttribute1 = gameAttributeMapper.selectGameAttributeById(Long.valueOf(goodsInfoAndAttrValueDto.getF10()));
                if(gameAttribute1.getFieldName().contains("可修改实名")) {
                    jsonObject.put("second_real", "是");
                    jsonObject.put("param_15", "能");
                }else{
                    jsonObject.put("second_real", "否");
                    jsonObject.put("param_15", "否");
                }
            }
            if(StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF2())) {
                GameAttribute gameAttribute1 = gameAttributeMapper.selectGameAttributeById(Long.valueOf(goodsInfoAndAttrValueDto.getF2()));
                jsonObject.put("param_2", gameAttribute1.getFieldName().replace("V",""));
            }
            if(StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF1())){
                jsonObject.put("param_3", goodsInfoAndAttrValueDto.getF1());
            }
            jsonObject.put("param_4", "未绑定或可换绑");
            if(StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF3())){
                GameAttribute gameAttribute1 = gameAttributeMapper.selectGameAttributeById(Long.valueOf(goodsInfoAndAttrValueDto.getF3()));
                jsonObject.put("param_5", gameAttribute1.getFieldName());
            }
            jsonObject.put("param_6", StringUtils.isEmpty(goodsInfoAndAttrValueDto.getF4())?"0":goodsInfoAndAttrValueDto.getF4());
            if(StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF8())) {
                jsonObject.put("param_7", goodsInfoAndAttrValueDto.getF8().split(",").length);
            }
            jsonObject.put("param_8", goodsInfoAndAttrValueDto.getF5()==null?"0":goodsInfoAndAttrValueDto.getF5());
            jsonObject.put("param_9", goodsInfoAndAttrValueDto.getF6()==null?"0":goodsInfoAndAttrValueDto.getF6());
            jsonObject.put("param_12", "自己注册");
            jsonObject.put("param_13", "否");
            //匹配多选项
            Property(goodsInfoAndAttrValueDto,jsonObject,params,salePartner);
        }
        if(goodsInfoAndAttrValueDto.getGameName().equals("英雄联盟")){
            jsonObject.put("system",goodsInfoAndAttrValueDto.getGroupName());
            jsonObject.put("server",goodsInfoAndAttrValueDto.getServerName());
            if(StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF1())) {
                GameAttribute gameAttribute1 = gameAttributeMapper.selectGameAttributeById(Long.valueOf(goodsInfoAndAttrValueDto.getF1()));
                if(gameAttribute1.getFieldName().equals("有修改人脸机会")){
                    jsonObject.put("second_real", "是");
                }else {
                    jsonObject.put("second_real", "否");
                }
            }else{
                jsonObject.put("second_real", "是");
            }
            jsonObject.put("param_2", goodsInfoAndAttrValueDto.getF3()==null?"0":goodsInfoAndAttrValueDto.getF3());
            jsonObject.put("param_4", "未绑定或可换绑");
            if(StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF2())) {
                GameAttribute gameAttribute1 = gameAttributeMapper.selectGameAttributeById(Long.valueOf(goodsInfoAndAttrValueDto.getF2()));
                jsonObject.put("param_5", gameAttribute1.getFieldName());
            }
            jsonObject.put("param_6", goodsInfoAndAttrValueDto.getF4()==null?"0":goodsInfoAndAttrValueDto.getF4());
            jsonObject.put("param_7", "初始注册");
            jsonObject.put("param_13", "否");
            jsonObject.put("param_15", "自己注册");
            //匹配多选项
            Property(goodsInfoAndAttrValueDto,jsonObject,params,salePartner);
        }
        if(goodsInfoAndAttrValueDto.getGameName().equals("火影忍者")){
            jsonObject.put("system",goodsInfoAndAttrValueDto.getSystemName()+goodsInfoAndAttrValueDto.getCarrierName());
            jsonObject.put("server","全区");
            if(StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF7())) {
                GameAttribute gameAttribute1 = gameAttributeMapper.selectGameAttributeById(Long.valueOf(goodsInfoAndAttrValueDto.getF7()));
                if(gameAttribute1.getFieldName().equals("可改二次")) {
                    jsonObject.put("second_real", "是");
                    jsonObject.put("param_15", "能");
                }else {
                    jsonObject.put("second_real", "否");
                    jsonObject.put("param_15", "否");
                }
            }
            if(StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF3())) {
                GameAttribute gameAttribute1 = gameAttributeMapper.selectGameAttributeById(Long.valueOf(goodsInfoAndAttrValueDto.getF3()));
                jsonObject.put("param_2", gameAttribute1.getFieldName().replace("V",""));
            }
            jsonObject.put("param_4", "未绑定或可换绑");
            if(StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF6())) {
                List<GameAttribute> gameAttributeList = getGameAttributs(goodsInfoAndAttrValueDto.getF6());
                jsonObject.put("param_8", gameAttributeList.stream().map(info -> info.getFieldName()).collect(Collectors.toList()).stream().collect(Collectors.joining(",")));
                jsonObject.put("param_10", goodsInfoAndAttrValueDto.getF6().split(",").length);
            }
            if(StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF5())) {
                List<GameAttribute> gameAttributeList = getGameAttributs(goodsInfoAndAttrValueDto.getF5());
                jsonObject.put("param_9", gameAttributeList.stream().map(info -> info.getFieldName()).collect(Collectors.toList()).stream().collect(Collectors.joining(",")));
                jsonObject.put("param_11", goodsInfoAndAttrValueDto.getF5().split(",").length);
            }
            jsonObject.put("param_12", "自己注册");
            jsonObject.put("param_13", "否");
        }
        if(goodsInfoAndAttrValueDto.getGameName().equals("原神")){
            jsonObject.put("system",goodsInfoAndAttrValueDto.getGroupName());
            jsonObject.put("server",goodsInfoAndAttrValueDto.getServerName());
            if(gameAttribute.getFieldName().equals("有修改人脸机会")){
                jsonObject.put("second_real", "是");
            }else{
                jsonObject.put("second_real", "否");
            }
            if(StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF2())) {
                GameAttribute gameAttribute1 = gameAttributeMapper.selectGameAttributeById(Long.valueOf(goodsInfoAndAttrValueDto.getF2()));
                if(gameAttribute1.getFieldName().equals("未绑定邮箱")){
                    jsonObject.put("param_1", "未绑邮箱或送三无邮箱");
                }else if(gameAttribute1.getFieldName().equals("送已实名邮箱")||gameAttribute1.getFieldName().equals("邮箱已实名")){
                    jsonObject.put("param_1", "送实名邮箱");
                }else {
                    jsonObject.put("param_1", "不送邮箱");
                }
            }
            if(StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF7())) {
                jsonObject.put("param_3", goodsInfoAndAttrValueDto.getF7());
            }
            jsonObject.put("param_4", "未绑定或可换绑");
            if(StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF11())) {
                List<GameAttribute> gameAttributeList = getGameAttributs(goodsInfoAndAttrValueDto.getF11());
                Map<String,Object> map = new HashMap<>();
                for(GameAttribute gameAttribute1 : gameAttributeList){
                    map.put(gameAttribute1.getFieldName().substring(2),gameAttribute1.getFieldName().substring(0,1).replace("满","6"));
                }
                jsonObject.put("param_5",JSONObject.toJSONString(map));
                jsonObject.put("param_9",goodsInfoAndAttrValueDto.getF11().split(",").length);
            }
            if(StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF17())) {
                List<GameAttribute> gameAttributeList = getGameAttributs(goodsInfoAndAttrValueDto.getF17());
                Map<String,Object> map = new HashMap<>();
                for(GameAttribute gameAttribute1 : gameAttributeList){
                    map.put(gameAttribute1.getFieldName().substring(2),gameAttribute1.getFieldName().substring(1,2));
                }
                jsonObject.put("param_8",JSONObject.toJSONString(map));
                jsonObject.put("param_10",goodsInfoAndAttrValueDto.getF17().split(",").length);
            }
            jsonObject.put("param_11", "自己注册");
            //匹配多选项
            Property(goodsInfoAndAttrValueDto,jsonObject,params,salePartner);
        }
        if(goodsInfoAndAttrValueDto.getGameName().equals("永劫无间")){
            if(goodsInfoAndAttrValueDto.getGroupName().contains("网易")) {
                jsonObject.put("system", "网易账号");
            }else if(goodsInfoAndAttrValueDto.getGroupName().contains("Steam")) {
                jsonObject.put("system", "Steam账号");
            }else {
                jsonObject.put("system", "Epic账号");
            }
            jsonObject.put("server","通用服务器");
            jsonObject.put("second_real", "是");
//            jsonObject.put("param_1", "送邮箱账号（实名邮箱）");
            jsonObject.put("param_2", "男");
            jsonObject.put("param_3", "30");
            jsonObject.put("param_4", "可换绑");
            jsonObject.put("param_7", "是");
            jsonObject.put("param_8", "自己注册");
            //匹配多选项
            Property(goodsInfoAndAttrValueDto,jsonObject,params,salePartner);
        }
        if(goodsInfoAndAttrValueDto.getGameName().equals("英雄联盟(手游)")){
            jsonObject.put("system",goodsInfoAndAttrValueDto.getSystemName()+goodsInfoAndAttrValueDto.getCarrierName());
            jsonObject.put("server","通用服务器");
            jsonObject.put("shop_insure","1");
            if(StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF4())) {
                GameAttribute gameAttribute1 = gameAttributeMapper.selectGameAttributeById(Long.valueOf(goodsInfoAndAttrValueDto.getF4()));
                if(gameAttribute1.getFieldName().equals("可二次实名")) {
                    jsonObject.put("second_real", "是");
                    jsonObject.put("param_15", "能");
                }else {
                    jsonObject.put("second_real", "否");
                    jsonObject.put("param_15", "不能");
                }
            }else {
                jsonObject.put("second_real", "否");
                jsonObject.put("param_15", "不能");
            }
            jsonObject.put("param_2", StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF5())?goodsInfoAndAttrValueDto.getF5():"0");

            if(StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF3())) {
                GameAttribute gameAttribute1 = gameAttributeMapper.selectGameAttributeById(Long.valueOf(goodsInfoAndAttrValueDto.getF3()));
                jsonObject.put("param_5", gameAttribute1.getFieldName().substring(2));
            }
            jsonObject.put("param_6", StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF6())?goodsInfoAndAttrValueDto.getF6():"0");
            if(StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF2())){
                List<GameAttribute> gameAttributs = getGameAttributs(goodsInfoAndAttrValueDto.getF2());
                String string = "";
                for(GameAttribute gameAttribute1: gameAttributs){
                    string+=","+gameAttribute1.getFieldName();
                }
                if(StringUtils.isNotEmpty(string)) {
                    jsonObject.put("param_10", string.substring(1));
                }
            }

            if(StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF1())){
                List<GameAttribute> gameAttributs = getGameAttributs(goodsInfoAndAttrValueDto.getF1());
                String string = "";
                for(GameAttribute gameAttribute1: gameAttributs){
                    string+=","+gameAttribute1.getFieldName();
                }
                if(StringUtils.isNotEmpty(string)) {
                    jsonObject.put("param_11", string.substring(1));
                }
            }
            jsonObject.put("param_12", "自己注册");
            jsonObject.put("param_13", "否");
            //匹配多选项
            Property(goodsInfoAndAttrValueDto,jsonObject,params,salePartner);
        }
        if(goodsInfoAndAttrValueDto.getGameName().equals("无畏契约")){
            jsonObject.put("system","pc端");
            jsonObject.put("server","国服");
            jsonObject.put("shop_insure","1");
            jsonObject.put("param_2","0");
            jsonObject.put("param_3","0");
            jsonObject.put("param_4","未绑定或可换绑");
            jsonObject.put("param_5","0");
            jsonObject.put("param_8","自己注册");
            jsonObject.put("param_13","否");
            jsonObject.put("param_14","0");
            if(StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF1())) {
                GameAttribute gameAttribute1 = gameAttributeMapper.selectGameAttributeById(Long.valueOf(goodsInfoAndAttrValueDto.getF1()));
                if(gameAttribute1.getFieldName().equals("可二次实名")) {
                    jsonObject.put("param_15", "能");
                }else {
                    jsonObject.put("param_15", "不能");
                }
            }else {
                jsonObject.put("param_15", "不能");
            }
            //匹配多选项
            Property(goodsInfoAndAttrValueDto,jsonObject,params,salePartner);
        }
        if (goodsInfoAndAttrValueDto.getGameName().equals("金铲铲之战")) {
            jsonObject.put("system", goodsInfoAndAttrValueDto.getSystemName() + goodsInfoAndAttrValueDto.getCarrierName());
            jsonObject.put("server", "通用服务器");
            jsonObject.put("shop_insure", "1");
            jsonObject.put("param_2", "0");
            jsonObject.put("param_2", "0"); //点券
            jsonObject.put("param_3", StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF11()) ? goodsInfoAndAttrValueDto.getF11() : 1); //角色等级
            jsonObject.put("param_4", "未绑定或可换绑"); //换绑手机：未绑定或可换绑，不可换绑
            jsonObject.put("param_5", "0"); //蓝色宝石



            jsonObject.put("param_6", StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF12())?goodsInfoAndAttrValueDto.getF12():"0"); //小小英雄数量

            jsonObject.put("param_8", "0"); //竞技场数量

            jsonObject.put("param_9", StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF14())?goodsInfoAndAttrValueDto.getF14():"0");//攻击特效数量
            jsonObject.put("param_13", "否"); //防沉迷：是，否
            jsonObject.put("param_14", "无"); //QQ等级：无，小于64级，大于64级
            if (StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF1())) {
                GameAttribute gameAttribute1 = gameAttributeMapper.selectGameAttributeById(Long.valueOf(goodsInfoAndAttrValueDto.getF1()));
                if (gameAttribute1.getFieldName().contains("包实名认证")) {
                    jsonObject.put("param_15", "不能");
                } else {
                    jsonObject.put("param_15", "能");
                }
            } else {
                jsonObject.put("param_15", "不能");
            }
            jsonObject.put("param_16", "自己注册"); //账号来源：'自己注册','之前购买'
            //匹配多选项
            Property(goodsInfoAndAttrValueDto,jsonObject,params,salePartner);
        }
        if (goodsInfoAndAttrValueDto.getGameName().equals("使命召唤手游")) {
            jsonObject.put("system", goodsInfoAndAttrValueDto.getSystemName() + goodsInfoAndAttrValueDto.getCarrierName());
            jsonObject.put("server", "通用服务器");
            jsonObject.put("shop_insure", "1");

            String pfIds = "";
            pfIds = reIds(pfIds, goodsInfoAndAttrValueDto.getF3());
            pfIds = reIds(pfIds, goodsInfoAndAttrValueDto.getF4());
            pfIds = reIds(pfIds, goodsInfoAndAttrValueDto.getF5());
            pfIds = reIds(pfIds, goodsInfoAndAttrValueDto.getF6());
            pfIds = reIds(pfIds, goodsInfoAndAttrValueDto.getF7());
            pfIds = reIds(pfIds, goodsInfoAndAttrValueDto.getF8());
            pfIds = reIds(pfIds, goodsInfoAndAttrValueDto.getF9());
            List<GameAttribute> roleAttributes = getGameAttributs(pfIds);
            Set<String> dataList = new HashSet<>();
            if (CollectionUtils.isNotEmpty(roleAttributes)) {
                dataList = roleAttributes.stream().map(s -> s.getFieldName()).collect(Collectors.toSet());
            }
            String[] dw = new String[]{"未定段", "青铜", "白银", "黄金", "白金", "钻石", "战神", "大师", "传奇战神"};
            for (String s : dw) {
                if (dataList.contains(s)) {
                    jsonObject.put("param_2", s); //段位
                }
            }
            jsonObject.put("param_3", "100");//角色等级
            jsonObject.put("param_4", "未绑定或可换绑");//换绑手机：'未绑定或可换绑','不可换绑'
            jsonObject.put("param_5", "0");//点券
            jsonObject.put("param_6", "0");//枪械数量
            jsonObject.put("param_7", StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF1()) ? goodsInfoAndAttrValueDto.getF1() : 0);//神话枪皮
            jsonObject.put("param_8", "0");//史诗枪皮
            jsonObject.put("param_11", "自己注册");//账号来源
            jsonObject.put("param_13", "是");//防沉迷
            jsonObject.put("param_14", "无");//Q等级
            jsonObject.put("param_15", "能");//能否二次实名
            //匹配多选项
            Property(goodsInfoAndAttrValueDto,jsonObject,params,salePartner);
        }
        if (goodsInfoAndAttrValueDto.getGameName().equals("暗区突围")){
            jsonObject.put("system", goodsInfoAndAttrValueDto.getSystemName() + goodsInfoAndAttrValueDto.getCarrierName());
            jsonObject.put("server", "通用服务器");
            jsonObject.put("shop_insure", "1");
            jsonObject.put("param_2", "1");
            jsonObject.put("param_3", "1");
            jsonObject.put("param_4", "未绑定或可换绑");
            jsonObject.put("param_6", StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF5())?goodsInfoAndAttrValueDto.getF5():"0");
            jsonObject.put("param_11", StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF4())?goodsInfoAndAttrValueDto.getF4():"0");
            jsonObject.put("param_13", "否");
            jsonObject.put("param_14", "无");
            if(StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF3())) {
                GameAttribute gameAttribute1 = gameAttributeMapper.selectGameAttributeById(Long.valueOf(goodsInfoAndAttrValueDto.getF3()));
                if(gameAttribute1.getFieldName().equals("可二次实名")) {
                    jsonObject.put("param_15", "能");
                }else {
                    jsonObject.put("param_15", "不能");
                }
            }else {
                jsonObject.put("param_15", "不能");
            }
            //匹配多选项
            Property(goodsInfoAndAttrValueDto,jsonObject,params,salePartner);
        }
        if (goodsInfoAndAttrValueDto.getGameName().equals("三角洲行动")){
            jsonObject.put("system", goodsInfoAndAttrValueDto.getSystemName() + goodsInfoAndAttrValueDto.getCarrierName());
            jsonObject.put("server", "官服");
            jsonObject.put("shop_insure", "1");

            jsonObject.put("param_5", StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF6())?goodsInfoAndAttrValueDto.getF6():"0");
            jsonObject.put("param_7", StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF5())?goodsInfoAndAttrValueDto.getF5():"0");
            jsonObject.put("param_8", "自己注册");
            jsonObject.put("param_13", "否");
            if(StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF7())) {
                GameAttribute gameAttribute1 = gameAttributeMapper.selectGameAttributeById(Long.valueOf(goodsInfoAndAttrValueDto.getF7()));
                if(gameAttribute1.getFieldName().equals("可二次实名")) {
                    jsonObject.put("param_15", "能");
                }else {
                    jsonObject.put("param_15", "不能");
                }
            }else {
                jsonObject.put("param_15", "不能");
            }
            //匹配多选项
            Property(goodsInfoAndAttrValueDto,jsonObject,params,salePartner);
        }
        params.put("shop_data",jsonObject);
        return params;
    }


    @Override
    public AjaxResult delGame(GoodsInfoAndAttrValueDto goodsInfoAndAttrValueDto, SalePartner salePartner) {
        Map<String, Object> params = new TreeMap<>();
        Map<String, Object> result = new HashMap<>();
        params.put("user_id", salePartner.getOther());
        ArtRec artRecreq = new ArtRec();
        artRecreq.setConfig(salePartner.getId());
        artRecreq.setAccountId(goodsInfoAndAttrValueDto.getId());
        List<ArtRec> artRecs = artRecMapper.selectArtRecList(artRecreq);
        ArtRec artRec = artRecs.get(0);
        params.put("shop_id", artRec.getOutid());
        String cover = MapUntils.getCover(params);
        cover = cover + "key=" + salePartner.getSaleKey();
        log.info(cover);
        String sign = DigestUtils.md5Hex(cover).toUpperCase();
        params.put("sign", sign);
        params.put("type", 2);
        log.info("易手游删除接口请求参数={}", JSONObject.toJSONString(params));
        String response = HttpUtils.sendPost("https://www.swcbg.com/api/api/downShop", JSONObject.toJSONString(params), "application/json");
        log.info("易手游删除接口返回参数={}", response);
        JSONObject resultJson = JSONObject.parseObject(response);
        if (!"1".equals(resultJson.getString("status"))) {
            result.put("code", 500);
        } else {
            result.put("code", 200);
        }
        artRecMapper.updateArtRec(artRec);
        result.put("req", JSONObject.toJSONString(params));
        result.put("res", response);
        result.put("msg", resultJson.getString("info"));
        return AjaxResult.success(result);
    }

    public static String createQQAccount() {
        int num = 8;
        String[] vec = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9"};
        num = num <= 0 ? 1 : num;
        StringBuffer str = new StringBuffer(10);
        for (int i = 0; i < num; i++) {
            int r1 = Long.valueOf(Math.round(Math.random() * (vec.length - 1))).intValue();
            str.append(vec[r1]);
        }
        return str.toString();
    }

    public static void main(String[] args) {
        Map<String, Object> params = new TreeMap<>();
        params.put("app_id", "2022538725651397".trim());
        String timestamp = new Date().getTime() / 1000 + "";
        params.put("timestamp", timestamp.trim());
        String cover = MapUntils.getCover(params);
        cover = cover.substring(0, cover.length() - 1) + "xyCExb66baBHAQTB";
        log.info(cover);
        String sign = DigestUtils.md5Hex(cover);
        log.info(sign);
        params.put("sign", sign);
        String response = HttpUtils.sendPost("http://goodsbuy.dailianba.com/api.php?m=api&c=Archives&a=lists", JSONObject.toJSONString(params), "application/json");
        log.info(response);
    }
}
